#pragma once
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>  //open函数的头文件
#include <stdio.h>  //标准输入输出
#include <unistd.h> //close函数,read函数
#include <string.h>
#include <sys/mman.h> //mmap函数的头文件
#include <linux/input.h>
#include <pthread.h>

#include "open.h"
#include "show_bmp.h"
#include "show_bt_bmp.h"



enum funcflag
{
    MENU = 0, // 在菜单页面的标志
    PHOTO,
    MUSIC,
    VIDEO
};

int flag = MENU;

#define FIFO_PATH "/tmp/myFifo"

char BT_name[][10] = {"photo.bmp", "music.bmp", "video.bmp"};

char photo_name[][10] = {"1.bmp", "2.bmp", "3.bmp", "4.bmp"};

char music_name[][128] = {"mplayer  2.mp3 -quiet -slave -geometry 0:0 -zoom -x 800 -y 400 -input file=/tmp/myFifo &"
						 ,"mplayer  /mnt/udisk/music/lzttdmg.mp3 -quiet -slave -geometry 0:0 -zoom -x 800 -y 400 -input file=/tmp/myFifo &"
						 ,"mplayer  /mnt/udisk/music/sn.mp3 -quiet -slave -geometry 0:0 -zoom -x 800 -y 400 -input file=/tmp/myFifo &"};


int send_cmd(int fd_fifo, const char *cmd)
{

	int ret_val = write(fd_fifo, cmd, strlen(cmd));
	if (-1 == ret_val)
	{
		perror("指令发送失败....\n");
		return -1;
	}

	printf("指令发送成功%d\n", ret_val);

	return 0;
}